<?php
/**
 * Created by Command.
 * User: Vito
 */

namespace app\admin\curd\building;

use app\common\curd\Update;
use app\model\Housing;
use app\logic\BuildingLogic;
class BuildingUpdate extends Update
{
    //验证器
    protected $validate = [];
    //允许新增的数据字段
    protected $field = [];
    //获取对象时追加的字段
    protected $appendField = [];
    //排除的数据
    protected $exclude = [];
    //条件
    protected $where = [];

    // protected $saveMiddleware = ['saveMiddleware', 'saveMiddlewared'];

    protected function saveMiddleware($next, $model,$params){

        // halt($model['id']);
        $where['id'] = $params['housing_id'];
        $name = Housing::getHousing($where);
        $params['name'] = $name;
        $BuildingLogic = new BuildingLogic;
        $BuildingLogic->updateRoom($model['id'], $params);
        // halt($params);
        return $next($model,$params);
    }   
}